package com.uyaer.el
{
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.utils.clearInterval;
	import flash.utils.setInterval;
	import flash.utils.setTimeout;
	
	import spark.components.Label;

	public class Tip
	{

		private static var tf:TextField;

		private static var effId:int;
		private static var effIndex:int;

		public function Tip()
		{
		}
		
		public static function show(str:String):void{
			if(!tf){
				tf = new TextField();
				tf.background = true;
				tf.backgroundColor = 0x06c4fb;
				tf.alpha = 0.35;
				tf.mouseEnabled = false;
				tf.border = true;
				tf.borderColor = 0x0d9fc9;
				tf.autoSize = TextFieldAutoSize.LEFT;
				RewardEditor.m_stage.addChild(tf);
				tf.defaultTextFormat = new TextFormat("宋体",16,0xffffff);
			}
			tf.text = str;
			tf.x = (RewardEditor.m_stage.stageWidth - tf.width)/2;
			tf.y = 10;
			if(effId>0){
				clearInterval(effId);
			}
			tf.alpha = 1;
			effIndex = 0;
			effId = setInterval(function():void{
				effIndex++;
				if(effIndex>10){
					tf.alpha -= 0.1;
					if(tf.alpha<=0){
						clearInterval(effId);
						effId = -1;
					}
				}
			},50);
		}
	}
}